{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Clustering by Wine Color\n",
    "\n",
    "## Wine Data\n",
    "Data from http://archive.ics.uci.edu/ml/datasets/Wine+Quality\n",
    "\n",
    "### Citations\n",
    "P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis. \n",
    "Modeling wine preferences by data mining from physicochemical properties.\n",
    "In Decision Support Systems, Elsevier, 47(4):547-553. ISSN: 0167-9236.\n",
    "\n",
    "Available at:\n",
    "- [@Elsevier](http://dx.doi.org/10.1016/j.dss.2009.05.016)\n",
    "- [Pre-press (pdf)](http://www3.dsi.uminho.pt/pcortez/winequality09.pdf)\n",
    "- [bib](http://www3.dsi.uminho.pt/pcortez/dss09.bib)\n",
    "\n",
    "Dua, D. and Karra Taniskidou, E. (2017). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.\n",
    "## Setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import pandas as pd\n",
    "import seaborn as sns\n",
    "\n",
    "red_wine = pd.read_csv('../../ch_09/data/winequality-red.csv')\n",
    "white_wine = pd.read_csv('../../ch_09/data/winequality-white.csv', sep=';')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## EDA"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fixed acidity</th>\n",
       "      <th>volatile acidity</th>\n",
       "      <th>citric acid</th>\n",
       "      <th>residual sugar</th>\n",
       "      <th>chlorides</th>\n",
       "      <th>free sulfur dioxide</th>\n",
       "      <th>total sulfur dioxide</th>\n",
       "      <th>density</th>\n",
       "      <th>pH</th>\n",
       "      <th>sulphates</th>\n",
       "      <th>alcohol</th>\n",
       "      <th>quality</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>7.0</td>\n",
       "      <td>0.27</td>\n",
       "      <td>0.36</td>\n",
       "      <td>20.7</td>\n",
       "      <td>0.045</td>\n",
       "      <td>45.0</td>\n",
       "      <td>170.0</td>\n",
       "      <td>1.0010</td>\n",
       "      <td>3.00</td>\n",
       "      <td>0.45</td>\n",
       "      <td>8.8</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>6.3</td>\n",
       "      <td>0.30</td>\n",
       "      <td>0.34</td>\n",
       "      <td>1.6</td>\n",
       "      <td>0.049</td>\n",
       "      <td>14.0</td>\n",
       "      <td>132.0</td>\n",
       "      <td>0.9940</td>\n",
       "      <td>3.30</td>\n",
       "      <td>0.49</td>\n",
       "      <td>9.5</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>8.1</td>\n",
       "      <td>0.28</td>\n",
       "      <td>0.40</td>\n",
       "      <td>6.9</td>\n",
       "      <td>0.050</td>\n",
       "      <td>30.0</td>\n",
       "      <td>97.0</td>\n",
       "      <td>0.9951</td>\n",
       "      <td>3.26</td>\n",
       "      <td>0.44</td>\n",
       "      <td>10.1</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>7.2</td>\n",
       "      <td>0.23</td>\n",
       "      <td>0.32</td>\n",
       "      <td>8.5</td>\n",
       "      <td>0.058</td>\n",
       "      <td>47.0</td>\n",
       "      <td>186.0</td>\n",
       "      <td>0.9956</td>\n",
       "      <td>3.19</td>\n",
       "      <td>0.40</td>\n",
       "      <td>9.9</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>7.2</td>\n",
       "      <td>0.23</td>\n",
       "      <td>0.32</td>\n",
       "      <td>8.5</td>\n",
       "      <td>0.058</td>\n",
       "      <td>47.0</td>\n",
       "      <td>186.0</td>\n",
       "      <td>0.9956</td>\n",
       "      <td>3.19</td>\n",
       "      <td>0.40</td>\n",
       "      <td>9.9</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   fixed acidity  volatile acidity  citric acid  residual sugar  chlorides  \\\n",
       "0            7.0              0.27         0.36            20.7      0.045   \n",
       "1            6.3              0.30         0.34             1.6      0.049   \n",
       "2            8.1              0.28         0.40             6.9      0.050   \n",
       "3            7.2              0.23         0.32             8.5      0.058   \n",
       "4            7.2              0.23         0.32             8.5      0.058   \n",
       "\n",
       "   free sulfur dioxide  total sulfur dioxide  density    pH  sulphates  \\\n",
       "0                 45.0                 170.0   1.0010  3.00       0.45   \n",
       "1                 14.0                 132.0   0.9940  3.30       0.49   \n",
       "2                 30.0                  97.0   0.9951  3.26       0.44   \n",
       "3                 47.0                 186.0   0.9956  3.19       0.40   \n",
       "4                 47.0                 186.0   0.9956  3.19       0.40   \n",
       "\n",
       "   alcohol  quality  \n",
       "0      8.8        6  \n",
       "1      9.5        6  \n",
       "2     10.1        6  \n",
       "3      9.9        6  \n",
       "4      9.9        6  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "white_wine.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fixed acidity</th>\n",
       "      <th>volatile acidity</th>\n",
       "      <th>citric acid</th>\n",
       "      <th>residual sugar</th>\n",
       "      <th>chlorides</th>\n",
       "      <th>free sulfur dioxide</th>\n",
       "      <th>total sulfur dioxide</th>\n",
       "      <th>density</th>\n",
       "      <th>pH</th>\n",
       "      <th>sulphates</th>\n",
       "      <th>alcohol</th>\n",
       "      <th>quality</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>7.4</td>\n",
       "      <td>0.70</td>\n",
       "      <td>0.00</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.076</td>\n",
       "      <td>11.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>0.9978</td>\n",
       "      <td>3.51</td>\n",
       "      <td>0.56</td>\n",
       "      <td>9.4</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>7.8</td>\n",
       "      <td>0.88</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2.6</td>\n",
       "      <td>0.098</td>\n",
       "      <td>25.0</td>\n",
       "      <td>67.0</td>\n",
       "      <td>0.9968</td>\n",
       "      <td>3.20</td>\n",
       "      <td>0.68</td>\n",
       "      <td>9.8</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>7.8</td>\n",
       "      <td>0.76</td>\n",
       "      <td>0.04</td>\n",
       "      <td>2.3</td>\n",
       "      <td>0.092</td>\n",
       "      <td>15.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>0.9970</td>\n",
       "      <td>3.26</td>\n",
       "      <td>0.65</td>\n",
       "      <td>9.8</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>11.2</td>\n",
       "      <td>0.28</td>\n",
       "      <td>0.56</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.075</td>\n",
       "      <td>17.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>0.9980</td>\n",
       "      <td>3.16</td>\n",
       "      <td>0.58</td>\n",
       "      <td>9.8</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>7.4</td>\n",
       "      <td>0.70</td>\n",
       "      <td>0.00</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.076</td>\n",
       "      <td>11.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>0.9978</td>\n",
       "      <td>3.51</td>\n",
       "      <td>0.56</td>\n",
       "      <td>9.4</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   fixed acidity  volatile acidity  citric acid  residual sugar  chlorides  \\\n",
       "0            7.4              0.70         0.00             1.9      0.076   \n",
       "1            7.8              0.88         0.00             2.6      0.098   \n",
       "2            7.8              0.76         0.04             2.3      0.092   \n",
       "3           11.2              0.28         0.56             1.9      0.075   \n",
       "4            7.4              0.70         0.00             1.9      0.076   \n",
       "\n",
       "   free sulfur dioxide  total sulfur dioxide  density    pH  sulphates  \\\n",
       "0                 11.0                  34.0   0.9978  3.51       0.56   \n",
       "1                 25.0                  67.0   0.9968  3.20       0.68   \n",
       "2                 15.0                  54.0   0.9970  3.26       0.65   \n",
       "3                 17.0                  60.0   0.9980  3.16       0.58   \n",
       "4                 11.0                  34.0   0.9978  3.51       0.56   \n",
       "\n",
       "   alcohol  quality  \n",
       "0      9.4        5  \n",
       "1      9.8        5  \n",
       "2      9.8        5  \n",
       "3      9.8        6  \n",
       "4      9.4        5  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "red_wine.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'quality score')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAsoAAADgCAYAAAAaPkA5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3Xt4VNXZ9/HvHRJARAVUrBEQEQrIURIED/VUNbTSWOVRVBTrice3tNWi0loKGsAWtbRKRQSsJaUKRX2qeEJUBCxyMJRwEERQqBw8UYmgEyAJ9/vH3sQQJskEmMxAfp/rmiuz16y19r0n+5rcWbP22ubuiIiIiIjI3lISHYCIiIiISDJSoiwiIiIiEoUSZRERERGRKJQoi4iIiIhEoURZRERERCQKJcoiIiIiIlEoURaRQ46ZuZm1ruC1fmY2s6ZjCvfdwsy+NrM6idj/gTCzn5jZv8psf21mrRIZk4hIoilRFpGEMrN7zOyVcmVrKii7uqr+3P0pd7+kTLsKk+oYYhtvZo+V2U4zs28qKOvp7h+7e0N3L9mf/cUQz0/MbLmZRczsUzN7zMyOice+wuP4KNzvJDMbub99mdk5ZvaOmX1lZl+a2Twz637wohURiQ8lyiKSaHOBs/eMwprZd4A0oFu5stZh3ZqO7bwy25nAx8C55coAFsczEDO7E3gAuBs4BugJtARmmllaPPd9IMzsaOAl4M9AE+AkIAfYeZD3c8iN4otI8lOiLCKJ9i5BYtw13D4X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aJe5XphiMiIiIicjCZ2WJ3z6yqXtxGlN19GXB6vPoXEREREYmnpLqFdd2TGmoEWURERESSwiFzC2sRERERkZqkRFlEREREJAolyiIiIiIiUShRFhERERGJQomyiIiIiEgUSpRFRERERKJQoiwiIiIiEoUSZRERERGRKJQoi4iIiIhEoURZRERERCQKJcoiIiIiIlGkJjqAsj77aC2j+/ZOdBj75c5/vJToEERERETkINKI8kG0Y8cOzjjjDLp06UKHDh24995796nz+OOP06lTJ7p27co555zDypUrAZg3bx6dO3eme/furF27FoCCggKysrJw9xo9DhERERGpgUTZzOqY2RIzO+yHXOvVq8esWbNYunQp+fn5zJgxgwULFuxV59prr2X58uXk5+czePBgBg0aBMDo0aN57rnn+N3vfse4ceMAGDFiBL/5zW8wsxo/FhEREZHariZGlG8HVtXAfhLOzGjYsCEARUVFFBUV7ZPkHn300aXPv/nmm9LX09LSKCwsJBKJkJaWxocffsimTZs477zzau4ARERERKRUXOcom1kz4FLgfmBQPPeVLEpKSsjIyGDt2rUMHDiQHj167FNn7Nix/PGPf2TXrl3MmjULgHvuuYcBAwZwxBFHMHnyZO666y5GjBhR0+GLiIiISCjeI8oPA4OB3XHeT9KoU6cO+fn5bNy4kUWLFrFixYp96gwcOJAPP/yQBx54gJEjRwLQtWtXFixYwFtvvcVHH31Eeno67k7fvn257rrr+Oyzz2r6UERERERqtbglymbWG/jc3RdXUW+AmeWZWd43O3fFK5wa16hRI84//3xmzJhRYZ2rr76a559/fq8yd2fkyJEMHTqUnJwccnJyuO666xgzZky8QxYRERGRMuI5onw2kG1m64GpwIVm9vfyldx9grtnunvmkfXqxjGc+Pviiy8oKCgAoLCwkDfeeIN27drtVWfNmjWlz19++WXatGmz1+u5ublceumlNG7cmEgkQkpKCikpKUQikfgfgIiIiIiUitscZXe/B7gHwMzOB+5y9+vitb9k8Mknn3DDDTdQUlLC7t27ueqqq+jduzfDhg0jMzOT7OxsHn30Ud544w3S0tJo3Lgxubm5pe0jkQi5ubnMnDkTgEGDBtGn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Z88GYOfOnfTq1YuOHTvy2GOPldYfMGAAS5YsqXZssYwo7zcza2Rmz5rZ+2a2yszOjOf+REREROTQ8sgjj9C+/d5Tb/Py8igoKKigBUycOBGA5cuX8/rrr3PnnXeye/duXnvtNTIyMli2bBkTJkwAYOnSpezevZvTTz+92rHFNVEGHgFmuHs7oAtwaExIEREREZG427hxIy+//DK33HJLaVlJSQl33303Dz74YIXtVq5cyfe//30AmjZtSqNGjcjLyyMtLY3CwkKKi4tL6w4dOpThw4fvV3yxLA9XZ386NrOjgXOBvwC4+y53r/hfAxERERGpVe644w4efPBBUlK+TUkfffRRsrOzOfHEEyts16VLF1544QWKi4tZt24dixcvZsOGDVx88cV8+umn9OjRg8GDBzN9+nQyMjJIT0/fr/hiWfVirZk9S7A03Mpq9N0K+IJg3eUuwGLgdnf/pmwlMxtAcOc/TkyNJRwREREROdS99NJLNG3alIyMjNI5xps3b+aZZ54p3a7ITTfdxKpVq8jMzOTkk0/mrLPOIjU1ldTUVJ5++mkAioqKyMrKYvr06QwaNIiPP/6Y/v37k52dHXOM5u6VVzA7CrgauJFgBPpJYGq4tnJl7TKBBcDZ7r7QzB4Btrn70IradKx/hD/TsmXMwYuIiIjIoaf9+6u45557mDx5MqmpqezYsYNt27ZRr1496tWrR/369QH4+OOPadWqFWvXrq20v7POOosnnniC0047rbTskUceoVGjRqSnp/Pmm29y//33c+aZZ7Jo0SLMbLG7Z1YVZyyrXmx394nufhYwGLgX+MTMcs2sdSVNNwIb3X1huP0s0K2q/YmIiIjI4e/3v/89GzduZP369UydOpULL7yQrVu38umnn7J+/XrWr19PgwYNoibJkUiEb74JJim8/vrrpKam7pUkb926lZdeeon+/fsTiURISUnBzNixY0e1YoxpjrKZZZvZPwkuzhtNMK3iReCVitq5+6fABjNrGxZ9H6jO1A0REREREQCmT5/OsGHDAPj888/p1q0b7du354EHHmDy5Ml71R0+fDi//e1vMTOysrLIy8ujU6dO3HrrrdXaZyxTLz4C3gL+4u7vlHttjLv/opK2XYE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QVFREVlYW06dPZ9CgQXz88cf079+f7OzsGjkOERE5NFU5R9nd/1vmscndHwYujHUH4YWA2cAzFbw+wMzyzCyvZHtJzIGLyOEvNzeXK664AoArr7wy6sV8zZo1Y8OGDaXbGzdu3GfU+LHHHuOGG25g/vz51K1bl3/84x+MHDkyvsGLiMghL5YbjnQr88g0s9uAo6qxjx8A/3b3z6K96O4T3D3T3TPrHFWnGt2KyOEuPT2dOXPmADBr1izatGmzT52srCxmzpzJ1q1b2bp1KzNnziQrK6v09a1bt/LSSy/Rv39/IpEIKSkpmBk7duyoseMQEZFDUyxTL0aXeV4MrAeuqsY+rkHTLkSkCtdccw2zZ89my5YtNGvWjJycHCZOnMjtt99OcXEx9evXL129Ii8vj8cff5wnnniCJk2aMHToULp37w7AsGHDSi/sAxg+fDi//e1vMTOysrIYO3YsnTp14rbbbkvIcYqIyKHDos3vO2idmzUANgCt3P2rquofccoR3vq+1nGLR0SSk244IiIiNcnMFrt7ZlX1Yln1YlBlr7v7Hyt5LQIcW9U+RERERESSTayrXnQHpofbPwLmEowUH1Qdju1A3g15B7tbEREREZFqiyVRPg7o5u7bAczsPuAZd78lnoGJiIiIiCRSLLewbgHsKrO9C2gZl2hERERERJJELCPKk4FFZvZPgjv0XQ7kxjUqEREREZEEqzJRdvf7zexV4Hth0Y3uviS+YYmIiIiIJFYsI8q4+7+Bf8c5FhERERGRpBHLHGURERERkVpHibKIiIiISBRKlEVEREREolCiLCIiIiIShRJlEREREZEolCiLiIiIiEQR0/JwNWbzErjvmERHceDu+yrREYiIiIjIAdKIcpzs2LGDM844gy5dutChQwfuvffeqPWmTZvGaaedRocOHbj22msBWL16NRkZGXTp0oX58+cDUFxczEUXXUQkEqmxYxARERGpzeI6omxmvwRuIbj19XKCu/rtiOc+k0W9evWYNWsWDRs2pKioiHPOOYcf/OAH9OzZs7TOmjVr+P3vf8+8efNo3Lgxn3/+OQDjx49n1KhRtGzZkl//+tc899xzjBs3juuvv54GDRok6pBEREREapW4jSib2Un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Pp7m2CqxHx3/wzYQfRpF5XpB9wcHvN7BEk/wEPhhYUrCBLxpdXsV0QkaWl5OBERERGRKDSiLCIiIiIShRJlEREREZEolCiLiIiIiEShRFlEREREJAolyiIiIiIiUShRFhERERGJQomyiIiIiEgUSpRFRERERKL4/2/6087OgOnUAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 864x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "ax = white_wine.quality.value_counts().sort_index(\n",
    "    ascending=False\n",
    ").plot.barh(title='White Wine Quality Scores', figsize=(12, 3))\n",
    "for bar in ax.patches:\n",
    "    ax.text(\n",
    "        bar.get_width(), \n",
    "        bar.get_y() + bar.get_height()/4, \n",
    "        f'{bar.get_width()/white_wine.shape[0]:.1%}'\n",
    "    )\n",
    "plt.xlabel('count of wines')\n",
    "plt.ylabel('quality score')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Text(0, 0.5, 'quality score')"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAsoAAADgCAYAAAAaPkA5AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvnQurowAAIABJREFUeJzt3XuYFNWd//H3h2FER1REZX8iIiEq9/tgxAsaFLwhmmgQRcF4YU3IZo0rRnGDAhJjNAZciZcYI0GDQV2DgRVvgBKjEtDh4hVUFAQVVNAwCMPw/f3RxThAwzQ63T0Mn9fz9NNVp06d+tbpoZ8vp09VKSIwMzMzM7PN1cl3AGZmZmZmNZETZTMzMzOzNJwom5mZmZml4UTZzMzMzCwNJ8pmZmZmZmk4U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aThRNjMzMzNLw4mymZmZmVka/x9NcDsDWnogJQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 864x216 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "ax = red_wine.quality.value_counts().sort_index(\n",
    "    ascending=False\n",
    ").plot.barh(title='Red Wine Quality Scores', figsize=(12, 3))\n",
    "for bar in ax.patches:\n",
    "    ax.text(\n",
    "        bar.get_width(), \n",
    "        bar.get_y() + bar.get_height()/4, \n",
    "        f'{bar.get_width()/red_wine.shape[0]:.1%}'\n",
    "    )\n",
    "plt.xlabel('count of wines')\n",
    "plt.ylabel('quality score')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fixed acidity</th>\n",
       "      <th>volatile acidity</th>\n",
       "      <th>citric acid</th>\n",
       "      <th>residual sugar</th>\n",
       "      <th>chlorides</th>\n",
       "      <th>free sulfur dioxide</th>\n",
       "      <th>total sulfur dioxide</th>\n",
       "      <th>density</th>\n",
       "      <th>pH</th>\n",
       "      <th>sulphates</th>\n",
       "      <th>alcohol</th>\n",
       "      <th>quality</th>\n",
       "      <th>kind</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>848</th>\n",
       "      <td>6.4</td>\n",
       "      <td>0.64</td>\n",
       "      <td>0.21</td>\n",
       "      <td>1.8</td>\n",
       "      <td>0.081</td>\n",
       "      <td>14.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>0.99689</td>\n",
       "      <td>3.59</td>\n",
       "      <td>0.66</td>\n",
       "      <td>9.8</td>\n",
       "      <td>5</td>\n",
       "      <td>red</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2529</th>\n",
       "      <td>6.6</td>\n",
       "      <td>0.42</td>\n",
       "      <td>0.13</td>\n",
       "      <td>12.8</td>\n",
       "      <td>0.044</td>\n",
       "      <td>26.0</td>\n",
       "      <td>158.0</td>\n",
       "      <td>0.99772</td>\n",
       "      <td>3.24</td>\n",
       "      <td>0.47</td>\n",
       "      <td>9.0</td>\n",
       "      <td>5</td>\n",
       "      <td>white</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>131</th>\n",
       "      <td>5.6</td>\n",
       "      <td>0.50</td>\n",
       "      <td>0.09</td>\n",
       "      <td>2.3</td>\n",
       "      <td>0.049</td>\n",
       "      <td>17.0</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.99370</td>\n",
       "      <td>3.63</td>\n",
       "      <td>0.63</td>\n",
       "      <td>13.0</td>\n",
       "      <td>5</td>\n",
       "      <td>red</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>244</th>\n",
       "      <td>15.0</td>\n",
       "      <td>0.21</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.2</td>\n",
       "      <td>0.075</td>\n",
       "      <td>10.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>1.00005</td>\n",
       "      <td>3.07</td>\n",
       "      <td>0.84</td>\n",
       "      <td>9.2</td>\n",
       "      <td>7</td>\n",
       "      <td>red</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1551</th>\n",
       "      <td>6.6</td>\n",
       "      <td>0.19</td>\n",
       "      <td>0.99</td>\n",
       "      <td>1.2</td>\n",
       "      <td>0.122</td>\n",
       "      <td>45.0</td>\n",
       "      <td>129.0</td>\n",
       "      <td>0.99360</td>\n",
       "      <td>3.09</td>\n",
       "      <td>0.31</td>\n",
       "      <td>8.7</td>\n",
       "      <td>6</td>\n",
       "      <td>white</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "      fixed acidity  volatile acidity  citric acid  residual sugar  chlorides  \\\n",
       "848             6.4              0.64         0.21             1.8      0.081   \n",
       "2529            6.6              0.42         0.13            12.8      0.044   \n",
       "131             5.6              0.50         0.09             2.3      0.049   \n",
       "244            15.0              0.21         0.44             2.2      0.075   \n",
       "1551            6.6              0.19         0.99             1.2      0.122   \n",
       "\n",
       "      free sulfur dioxide  total sulfur dioxide  density    pH  sulphates  \\\n",
       "848                  14.0                  31.0  0.99689  3.59       0.66   \n",
       "2529                 26.0                 158.0  0.99772  3.24       0.47   \n",
       "131                  17.0                  99.0  0.99370  3.63       0.63   \n",
       "244                  10.0                  24.0  1.00005  3.07       0.84   \n",
       "1551                 45.0                 129.0  0.99360  3.09       0.31   \n",
       "\n",
       "      alcohol  quality   kind  \n",
       "848       9.8        5    red  \n",
       "2529      9.0        5  white  \n",
       "131      13.0        5    red  \n",
       "244       9.2        7    red  \n",
       "1551      8.7        6  white  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wine = pd.concat([white_wine.assign(kind='white'), red_wine.assign(kind='red')])\n",
    "wine.sample(5, random_state=10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 6497 entries, 0 to 1598\n",
      "Data columns (total 13 columns):\n",
      "fixed acidity           6497 non-null float64\n",
      "volatile acidity        6497 non-null float64\n",
      "citric acid             6497 non-null float64\n",
      "residual sugar          6497 non-null float64\n",
      "chlorides               6497 non-null float64\n",
      "free sulfur dioxide     6497 non-null float64\n",
      "total sulfur dioxide    6497 non-null float64\n",
      "density                 6497 non-null float64\n",
      "pH                      6497 non-null float64\n",
      "sulphates               6497 non-null float64\n",
      "alcohol                 6497 non-null float64\n",
      "quality                 6497 non-null int64\n",
      "kind                    6497 non-null object\n",
      "dtypes: float64(11), int64(1), object(1)\n",
      "memory usage: 685.2+ KB\n"
     ]
    }
   ],
   "source": [
    "wine.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>fixed acidity</th>\n",
       "      <th>volatile acidity</th>\n",
       "      <th>citric acid</th>\n",
       "      <th>residual sugar</th>\n",
       "      <th>chlorides</th>\n",
       "      <th>free sulfur dioxide</th>\n",
       "      <th>total sulfur dioxide</th>\n",
       "      <th>density</th>\n",
       "      <th>pH</th>\n",
       "      <th>sulphates</th>\n",
       "      <th>alcohol</th>\n",
       "      <th>quality</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "      <td>6497.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>7.215307</td>\n",
       "      <td>0.339666</td>\n",
       "      <td>0.318633</td>\n",
       "      <td>5.443235</td>\n",
       "      <td>0.056034</td>\n",
       "      <td>30.525319</td>\n",
       "      <td>115.744574</td>\n",
       "      <td>0.994697</td>\n",
       "      <td>3.218501</td>\n",
       "      <td>0.531268</td>\n",
       "      <td>10.491801</td>\n",
       "      <td>5.818378</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>1.296434</td>\n",
       "      <td>0.164636</td>\n",
       "      <td>0.145318</td>\n",
       "      <td>4.757804</td>\n",
       "      <td>0.035034</td>\n",
       "      <td>17.749400</td>\n",
       "      <td>56.521855</td>\n",
       "      <td>0.002999</td>\n",
       "      <td>0.160787</td>\n",
       "      <td>0.148806</td>\n",
       "      <td>1.192712</td>\n",
       "      <td>0.873255</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>3.800000</td>\n",
       "      <td>0.080000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.600000</td>\n",
       "      <td>0.009000</td>\n",
       "      <td>1.000000</td>\n",
       "      <td>6.000000</td>\n",
       "      <td>0.987110</td>\n",
       "      <td>2.720000</td>\n",
       "      <td>0.220000</td>\n",
       "      <td>8.000000</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>6.400000</td>\n",
       "      <td>0.230000</td>\n",
       "      <td>0.250000</td>\n",
       "      <td>1.800000</td>\n",
       "      <td>0.038000</td>\n",
       "      <td>17.000000</td>\n",
       "      <td>77.000000</td>\n",
       "      <td>0.992340</td>\n",
       "      <td>3.110000</td>\n",
       "      <td>0.430000</td>\n",
       "      <td>9.500000</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>7.000000</td>\n",
       "      <td>0.290000</td>\n",
       "      <td>0.310000</td>\n",
       "      <td>3.000000</td>\n",
       "      <td>0.047000</td>\n",
       "      <td>29.000000</td>\n",
       "      <td>118.000000</td>\n",
       "      <td>0.994890</td>\n",
       "      <td>3.210000</td>\n",
       "      <td>0.510000</td>\n",
       "      <td>10.300000</td>\n",
       "      <td>6.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>7.700000</td>\n",
       "      <td>0.400000</td>\n",
       "      <td>0.390000</td>\n",
       "      <td>8.100000</td>\n",
       "      <td>0.065000</td>\n",
       "      <td>41.000000</td>\n",
       "      <td>156.000000</td>\n",
       "      <td>0.996990</td>\n",
       "      <td>3.320000</td>\n",
       "      <td>0.600000</td>\n",
       "      <td>11.300000</td>\n",
       "      <td>6.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>15.900000</td>\n",
       "      <td>1.580000</td>\n",
       "      <td>1.660000</td>\n",
       "      <td>65.800000</td>\n",
       "      <td>0.611000</td>\n",
       "      <td>289.000000</td>\n",
       "      <td>440.000000</td>\n",
       "      <td>1.038980</td>\n",
       "      <td>4.010000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>14.900000</td>\n",
       "      <td>9.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       fixed acidity  volatile acidity  citric acid  residual sugar  \\\n",
       "count    6497.000000       6497.000000  6497.000000     6497.000000   \n",
       "mean        7.215307          0.339666     0.318633        5.443235   \n",
       "std         1.296434          0.164636     0.145318        4.757804   \n",
       "min         3.800000          0.080000     0.000000        0.600000   \n",
       "25%         6.400000          0.230000     0.250000        1.800000   \n",
       "50%         7.000000          0.290000     0.310000        3.000000   \n",
       "75%         7.700000          0.400000     0.390000        8.100000   \n",
       "max        15.900000          1.580000     1.660000       65.800000   \n",
       "\n",
       "         chlorides  free sulfur dioxide  total sulfur dioxide      density  \\\n",
       "count  6497.000000          6497.000000           6497.000000  6497.000000   \n",
       "mean      0.056034            30.525319            115.744574     0.994697   \n",
       "std       0.035034            17.749400             56.521855     0.002999   \n",
       "min       0.009000             1.000000              6.000000     0.987110   \n",
       "25%       0.038000            17.000000             77.000000     0.992340   \n",
       "50%       0.047000            29.000000            118.000000     0.994890   \n",
       "75%       0.065000            41.000000            156.000000     0.996990   \n",
       "max       0.611000           289.000000            440.000000     1.038980   \n",
       "\n",
       "                pH    sulphates      alcohol      quality  \n",
       "count  6497.000000  6497.000000  6497.000000  6497.000000  \n",
       "mean      3.218501     0.531268    10.491801     5.818378  \n",
       "std       0.160787     0.148806     1.192712     0.873255  \n",
       "min       2.720000     0.220000     8.000000     3.000000  \n",
       "25%       3.110000     0.430000     9.500000     5.000000  \n",
       "50%       3.210000     0.510000    10.300000     6.000000  \n",
       "75%       3.320000     0.600000    11.300000     6.000000  \n",
       "max       4.010000     2.000000    14.900000     9.000000  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wine.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>kind</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>6497</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>unique</th>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>top</th>\n",
       "      <td>white</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>freq</th>\n",
       "      <td>4898</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         kind\n",
       "count    6497\n",
       "unique      2\n",
       "top     white\n",
       "freq     4898"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wine.describe(include='object')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "white    4898\n",
       "red      1599\n",
       "Name: kind, dtype: int64"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wine.kind.value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Clustering to Separate Red and White Wines"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.cluster import KMeans\n",
    "from sklearn.model_selection import train_test_split\n",
    "from sklearn.pipeline import Pipeline\n",
    "from sklearn.preprocessing import StandardScaler\n",
    "\n",
    "y = wine.kind\n",
    "X = wine.drop(columns=['quality', 'kind'])\n",
    "\n",
    "X_train, X_test, y_train, y_test = train_test_split(\n",
    "    X, y, test_size=0.25, random_state=0, stratify=y\n",
    ")\n",
    "\n",
    "kmeans_pipeline = Pipeline([\n",
    "    ('scale', StandardScaler()), ('kmeans', KMeans(n_clusters=2, random_state=0))\n",
    "]).fit(X_train)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Measure the agreement between predicted wine type and actual"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1    1211\n",
       "0     414\n",
       "dtype: int64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.Series(kmeans_pipeline.predict(X_test)).value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "white    1225\n",
       "red       400\n",
       "Name: kind, dtype: int64"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test.value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Fowlkes Mallows Index\n",
    "Values range from [0, 1] where 1 is perfect agreement:\n",
    "$$ FMI = \\frac{TP}{\\sqrt{(TP + FP)\\times(TP + FN)}} $$\n",
    "where\n",
    "- TP = points that are in the same cluster in the true labels are predicted to be in the same cluster\n",
    "- FP = points that are in the same cluster in the true labels but are not predicted to be in the same cluster\n",
    "- FP = points that are not in the same cluster in the true labels but are predicted to be in the same cluster"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9824673716471775"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.metrics import fowlkes_mallows_score\n",
    "# we need to make y_test binary, but which label red becomes doesn't matter for the result\n",
    "fowlkes_mallows_score(np.where(y_test == 'red', 0, 1), kmeans_pipeline.predict(X_test))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Finding the Centroids"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>fixed acidity</th>\n",
       "      <td>0.812282</td>\n",
       "      <td>-0.275524</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>volatile acidity</th>\n",
       "      <td>1.178543</td>\n",
       "      <td>-0.399759</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>citric acid</th>\n",
       "      <td>-0.368395</td>\n",
       "      <td>0.124959</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>residual sugar</th>\n",
       "      <td>-0.629024</td>\n",
       "      <td>0.213363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>chlorides</th>\n",
       "      <td>0.941155</td>\n",
       "      <td>-0.319237</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>free sulfur dioxide</th>\n",
       "      <td>-0.843413</td>\n",
       "      <td>0.286084</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>total sulfur dioxide</th>\n",
       "      <td>-1.191822</td>\n",
       "      <td>0.404263</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>density</th>\n",
       "      <td>0.663534</td>\n",
       "      <td>-0.225069</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>pH</th>\n",
       "      <td>0.573143</td>\n",
       "      <td>-0.194409</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>sulphates</th>\n",
       "      <td>0.848734</td>\n",
       "      <td>-0.287888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>alcohol</th>\n",
       "      <td>-0.069924</td>\n",
       "      <td>0.023718</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                             0         1\n",
       "fixed acidity         0.812282 -0.275524\n",
       "volatile acidity      1.178543 -0.399759\n",
       "citric acid          -0.368395  0.124959\n",
       "residual sugar       -0.629024  0.213363\n",
       "chlorides             0.941155 -0.319237\n",
       "free sulfur dioxide  -0.843413  0.286084\n",
       "total sulfur dioxide -1.191822  0.404263\n",
       "density               0.663534 -0.225069\n",
       "pH                    0.573143 -0.194409\n",
       "sulphates             0.848734 -0.287888\n",
       "alcohol              -0.069924  0.023718"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.DataFrame(\n",
    "    kmeans_pipeline.named_steps['kmeans'].cluster_centers_,\n",
    "    columns=X_train.columns\n",
    ").T"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
